FROM pytorch/pytorch:1.13.1-cuda11.6-cudnn8-runtime

WORKDIR /workspace/yolov7

COPY . .

# 安装系统依赖
RUN apt-get update && \
    apt-get install -y ffmpeg libsm6 libxext6 && \
    rm -rf /var/lib/apt/lists/*

# 升级 pip 并安装 requirements.txt 中的依赖
# 由于 torch/torchvision 已从 requirements.txt 移除或精确匹配，pip 不会尝试重新安装它们
RUN pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/ && \
    pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/

# CMD ["python"]